using System;
using System.Linq.Expressions;
using PropertyExpression.ControllableQuery.Test.Queries;
using PropertyExpression.ControllableQuery.Test.Queries.StringBuilding;
using PropertyExpression.ControllableQuery.Test.Queries.T4;
using PropertyExpression.ControllableQuery.TypedReader;
using PropertyExpression.Common;

namespace PropertyExpression.ControllableQuery.Test
{
    public static class PublicationInfoExtensions
    {
        private static readonly Expression<Func<IPublicationInfo, Guid>> publicationId = _ => _.PublicationId;
        public static Guid PublicationId(this IDataReader<IPublicationInfo> it)
        {
            return it.GetValue(publicationId);
        }
    }

    public static class PublicationTypeInfoExtensions
    {
        private static readonly Expression<Func<IPublicationTypeInfo, IOptionalValue<NVarChar<L4000>>>> description = _ => _.Description;
        public static IOptionalValue<NVarChar<L4000>> Description(this IDataReader<IPublicationTypeInfo> it)
        {
            return it.GetValue(description);
        }

        private static readonly Expression<Func<IPublicationTypeInfo, Decimal<P18, S7>>> decimal1 = _ => _.Decimal1;
        public static Decimal<P18, S7> Decimal1(this IDataReader<IPublicationTypeInfo> it)
        {
            return it.GetValue(decimal1);
        }

        private static readonly Expression<Func<IPublicationTypeInfo, Money>> money1 = _ => _.Money1;
        public static Money Money1(this IDataReader<IPublicationTypeInfo> it)
        {
            return it.GetValue(money1);
        }
    }

    public static class ModelPublicationInfoExtensions
    {
        private static readonly Expression<Func<IModelPublicationInfo, Guid>> publicationId = _ => _.PublicationId;
        public static Guid PublicationId(this IDataReader<IModelPublicationInfo> it)
        {
            return it.GetValue(publicationId);
        }

        private static readonly Expression<Func<IModelPublicationInfo, NVarChar<L20>>> modelCode = _ => _.ModelCode;
        public static NVarChar<L20> ModelCode(this IDataReader<IModelPublicationInfo> it)
        {
            return it.GetValue(modelCode);
        }

        private static readonly Expression<Func<IModelPublicationInfo, NVarChar<L2>>> modelSequence = _ => _.ModelSequence;
        public static NVarChar<L2> ModelSequence(this IDataReader<IModelPublicationInfo> it)
        {
            return it.GetValue(modelSequence);
        }
    }

    public static class PartLinkInfoExtensions
    {
        private static readonly Expression<Func<IPartLinkInfo, IOptionalValue<NVarChar<L15>>>> partNumber = _ => _.PartNumber;
        public static IOptionalValue<NVarChar<L15>> PartNumber(this IDataReader<IPartLinkInfo> it)
        {
            return it.GetValue(partNumber);
        }
    }
}